use axum::{http::StatusCode, routing::get, Json, Router};
use common::{service::*, ApiResponse};

async fn health() -> (StatusCode, Json<ApiResponse<&'static str>>) {
    (StatusCode::OK, Json(ApiResponse::ok("OK")))
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    init_tracing();
    dotenvy::dotenv().ok();

    let app = Router::new().route("/health", get(health));
    start_service("Communication service", &env_or("COMMUNICATION_SERVICE_PORT", "8092"), app).await
}

